class AxisY {
	constructor (param) {
		this.value = param.value;
		this.fontSize = param.fontSize || 20;
		this.color = param.color || '#eee';
		this.width = param.width || '0';
		this.lineWidth = param.lineWidth || 1;
		this.lineColor = param.lineColor || '#eee';
		this.x = param.x || 0;
		this.y = param.y || 0;
	}

	draw (ctx, offsetX = 0) {
		ctx.setFillStyle(this.color);
		ctx.setFontSize(this.fontSize);
		ctx.setTextAlign('left');
		ctx.setTextBaseline('middle');
		ctx.fillText(this.value, this.x, this.y);
		ctx.setStrokeStyle(this.lineColor);
		ctx.beginPath();
		ctx.moveTo(this.x + offsetX, this.y);
		ctx.lineTo(this.x + this.width + offsetX, this.y);
		ctx.closePath();
		ctx.stroke();
	}

	static drawUnit (ctx, unit, x, y) {
		ctx.fillText(unit, x, y);
	}
}

module.exports = AxisY;